/*!
 * Header file correcponding to a movie. (movie.cpp)
 * @author Mazzer Yannis, Calingarayar Martial
 */
#ifndef _MOVIE_H
#define _MOVIE_H

#include <QString>
#include <QDate>
#include <QTime>
#include <QList>
#include <QTreeWidget>
#include <QMap>
#include <QSqlTableModel>
#include <QDataWidgetMapper>
#include <QSqlRecord>
#include "ui_moviedescr.h"

/*!
 * This class gathers all the informations about a movie.
 */
class Movie : public QWidget, private Ui::MovieDescriptor
{
    Q_OBJECT
    public:

/*!
 * Movie class constructor.
 * @param parent A pointer to the parent which calle the constructor.
 */
	Movie(QWidget *parent = 0);

/*!
 * This function gives the number of the movie.
 * @return The number of the movie.
 */
	int getNumero();

/*!
 * This function gives the movie title.
 * @return The movie title.
 */
	QString getTitle();

/*!
 * This function gives the movie title.
 * @return The original movie title.
 */
	QString getOriginalTitle();

/*!
 * This function gives the date of release of movie.
 * @return The released date of movie.
 */
	QDate getReleaseDate();

/*!
 * This function gives the director of movie.
 *@return The director of movie.
 */
	QString getDirector();

/*!
 * This function gives the lenght of movie.
 *@return The lenght of movie.
 */
	QTime getLength();

/*!
 * This function gives the country.
 *@return The country of movie.
 */
	QString getCountry();

/*!
 * This function gives the minimum age to watch the movie.
 *@return The minimum age to watch the movie.
 */
	QString getMinAge();

//	QPixmap getPicture();
//	ActorMap getCasting();
//	LangList getLang();

/*!
 * This function gives the index of the class.
 * @return The index to which the class Movie refers.
 */
	int getIndex();


/*!
 * Determines the index in the model.
 * @param index the new index in the model
 * @param model the model the View is related to
 */
	void setModelIndex(const QModelIndex &index, QSqlTableModel  *model);

/*!
 * Function that sets the casting.
 */
	void castSetUp();

/*!
 * Function that sets the language.
 */
	void langSetUp();

/*!
 * Function that sets the number's movie.
 * @param &newNumero the new number of the mmovie.
 */
	void setNumero(const int &newNumero);

/*!
 * Function that sets the title's movie.
 * @param &newTitle the new title of the movie.
 */
	void setTitle(const QString &newTitle);

/*!
 * Function that sets the original title's movie.
 * @param &newOriginalTitle the new original title of the movie.
 */
	void setOriginalTitle(const QString &newOriginalTitle);

/*!
 * Function that sets the release date's movie.
 * @param &newReleaseDate the new release date of the movie.
 */
	void setReleaseDate(const QDate &newReleaseDate);

/*!
 * Function that sets the director's movie.
 * @param &newDirector the new director of the movie.
 */
	void setDirector(const QString &newDirector);

/*!
 * Function that sets the lenght's movie.
 * @param &newLength the new lenght of the movie.
 */
	void setLength(const QTime &newLength);

/*!
 * Function that sets the country's movie.
 * @param &newCountry the new country of the movie.
 */
	void setCountry(const QString &newCountry);

/*!
 * Function that sets the minimun age's movie.
 * @param &newMinAge the new minimum age of the movie.
 */
	void setMinAge(const QString &newMinAge);

 //	void setPicture(const QPixmap &newPicture);
//	void setCasting(const ActorMap &newCasting);
//	void setLang(const LangList &newLang);



    private slots:
/*!
 * This slot actually draw the widget and its content, it sets the
 * widgets positions. And finally shows it.
 */
	void draw();

/*!
 * This slot is used to relocate the index in the model when the latter has
 * been resetted. it uses the unique id from the database to do it.
 */
	void resetIndex();

    private:
	int numero;
//	QPixmap picture;
//	ActorMap casting;
//	LangList lang;
	QSqlRecord record;
	QDataWidgetMapper *mapper;
	QModelIndexList pList;
	QSqlTableModel *mod;
	QSqlTableModel *langModel;
	QSqlTableModel *castModel;


};

#endif // _MOVIE_H
